package GUI;

import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.border.LineBorder;
import javax.swing.JButton;

import logic.Message;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import javax.swing.UIManager;

public class Late_report_result extends JPanel {
	private Client_GUI parent;
	
	//dfxhdnxthgjcmfgxhcg
	public Late_report_result(final Client_GUI parent,Message msg,final LateReturnReport back,String name) {
		setBackground(UIManager.getColor("inactiveCaption"));
		this.parent = parent;
		this.setSize(Client_GUI.MAIN_WIDTH, Client_GUI.MAIN_HEIGHT);
		setLayout(null);
		
		ArrayList<Object> arr = msg.GetMessageData();
		ArrayList<String> dist_array = (ArrayList<String>)arr.get(0);
		String avg=(String) arr.get(1);
		String medrian=(String) arr.get(2);
		
		 msg.GetMessageData().get(0);
		 msg.GetMessageData().get(0);
		
		JLabel lblLateReturnReport = new JLabel("Late Return Report:  " + name);
		lblLateReturnReport.setForeground(Color.RED);
		lblLateReturnReport.setFont(new Font("Tahoma", Font.BOLD, 20));
		lblLateReturnReport.setBounds(204, 44, 411, 36);
		add(lblLateReturnReport);
		
		JPanel panel = new JPanel();
		panel.setBorder(new LineBorder(new Color(0, 0, 0), 2));
		panel.setBounds(430, 114, 338, 297);
		add(panel);
		panel.setLayout(null);
		
		JLabel lblDayDelay = new JLabel("1 Day Delay:");
		lblDayDelay.setBounds(56, 62, 114, 36);
		panel.add(lblDayDelay);
		lblDayDelay.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		JLabel lblDaysDelay = new JLabel("2 Days Delay:");
		lblDaysDelay.setBounds(56, 109, 114, 36);
		panel.add(lblDaysDelay);
		lblDaysDelay.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		JLabel lblDaysDelay_1 = new JLabel("3 Days Delay:");
		lblDaysDelay_1.setBounds(56, 156, 114, 36);
		panel.add(lblDaysDelay_1);
		lblDaysDelay_1.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		JLabel lblDaysDelay_3 = new JLabel("5+ Days Delay:");
		lblDaysDelay_3.setBounds(56, 245, 114, 36);
		panel.add(lblDaysDelay_3);
		lblDaysDelay_3.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		JLabel lblDaysDelay_2 = new JLabel("4 Days Delay:");
		lblDaysDelay_2.setBounds(56, 203, 114, 36);
		panel.add(lblDaysDelay_2);
		lblDaysDelay_2.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		JLabel lblDistribution = new JLabel("Distribution");
		lblDistribution.setForeground(Color.RED);
		lblDistribution.setFont(new Font("Tahoma", Font.BOLD, 15));
		lblDistribution.setBounds(118, 23, 101, 28);
		panel.add(lblDistribution);
		
		JLabel LBL1 = new JLabel(dist_array.get(0));
		LBL1.setBounds(179, 62, 101, 36);
		panel.add(LBL1);
		
		JLabel label_1 = new JLabel("%");
		label_1.setFont(new Font("Tahoma", Font.BOLD, 15));
		label_1.setBounds(256, 121, 24, 24);
		panel.add(label_1);
		
		JLabel label_2 = new JLabel("%");
		label_2.setFont(new Font("Tahoma", Font.BOLD, 15));
		label_2.setBounds(256, 74, 24, 24);
		panel.add(label_2);
		
		JLabel lblNewLabel = new JLabel("%");
		lblNewLabel.setBounds(256, 168, 24, 24);
		panel.add(lblNewLabel);
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 15));
		
		JLabel label = new JLabel("%");
		label.setBounds(256, 215, 24, 24);
		panel.add(label);
		label.setFont(new Font("Tahoma", Font.BOLD, 15));
		
		JLabel label_3 = new JLabel("%");
		label_3.setFont(new Font("Tahoma", Font.BOLD, 15));
		label_3.setBounds(256, 257, 24, 24);
		panel.add(label_3);
		
		JLabel label_4 = new JLabel(dist_array.get(1));
		label_4.setBounds(179, 109, 101, 36);
		panel.add(label_4);
		
		JLabel label_5 = new JLabel(dist_array.get(2));
		label_5.setBounds(179, 156, 101, 36);
		panel.add(label_5);
		
		JLabel label_6 = new JLabel(dist_array.get(3));
		label_6.setBounds(179, 203, 101, 36);
		panel.add(label_6);
		
		JLabel label_7 = new JLabel(dist_array.get(4));
		label_7.setBounds(179, 245, 101, 36);
		panel.add(label_7);
		
		JPanel panel_1 = new JPanel();
		panel_1.setBorder(new LineBorder(new Color(0, 0, 0), 2));
		panel_1.setBounds(68, 162, 292, 206);
		add(panel_1);
		panel_1.setLayout(null);
		
		JLabel lblAvarge = new JLabel("Avarge :");
		lblAvarge.setBounds(27, 63, 119, 36);
		panel_1.add(lblAvarge);
		lblAvarge.setFont(new Font("Tahoma", Font.BOLD, 13));
		
		JLabel lblMadrian = new JLabel("Madrian:");
		lblMadrian.setBounds(27, 110, 86, 36);
		panel_1.add(lblMadrian);
		lblMadrian.setFont(new Font("Tahoma", Font.BOLD, 13));
		
		JLabel labelmed = new JLabel(avg);
		labelmed.setBounds(156, 110, 79, 29);
		panel_1.add(labelmed);
		
		JLabel labelavg = new JLabel(medrian);
		labelavg.setBounds(156, 70, 79, 29);
		panel_1.add(labelavg);
		
		JButton btnNewButton = new JButton("Back");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				parent.RepaintMain(back);
			}
		});
		btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 11));
		btnNewButton.setBounds(159, 450, 147, 36);
		add(btnNewButton);
		
		JButton button = new JButton("Done");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Home home = new Home(parent,parent.client.publicMessages);
				VerifyDialog verify = new VerifyDialog(parent,home,false);
			}
		});
		button.setFont(new Font("Tahoma", Font.BOLD, 11));
		button.setBounds(511, 450, 147, 36);
		add(button);
	}
}
